package com.haochang.chunkvod.model.order;

import java.io.Serializable;

import org.json.JSONArray;
import org.json.JSONObject;

import com.haochang.chunkvod.tools.vod.goods.ShoppingCartManager;

/**
 *@author qintao
 *created at 2016/6/22 14:28
 * 套餐详情
 */

public class FoodDetailInfo implements Serializable
{
	private String combo_id;
	private String food_id;
	private String name;
	private int quantity;
	private int weight;
	private int price;
	private String taste_types;
	private String unit;
	private int number;
	private String flavor;
	private int output_status;
	private String d_id_key;
	private String d_id_value;
	private String standard;
	private String standard_types;
	private String operateTypeId = "";//商品运营小类id

	public String getName()
	{
		return name;
	}

	public void setName(String name)
	{
		this.name = name;
	}

	public int getQuantity()
	{
		return quantity;
	}

	public void setQuantity(int quantity)
	{
		this.quantity = quantity;
	}

	public String getCombo_id()
	{
		return combo_id;
	}

	public void setCombo_id(String combo_id)
	{
		this.combo_id = combo_id;
	}

	public String getFood_id()
	{
		return food_id;
	}

	public void setFood_id(String food_id)
	{
		this.food_id = food_id;
	}

	public int getWeight()
	{
		return weight;
	}

	public void setWeight(int weight)
	{
		this.weight = weight;
	}

	public int getPrice()
	{
		return price;
	}

	public void setPrice(int price)
	{
		this.price = price;
	}

	public String getTaste_types()
	{
		return taste_types;
	}

	public void setTaste_types(String taste_types)
	{
		this.taste_types = taste_types;
	}

	public String getUnit()
	{
		return unit;
	}

	public void setUnit(String unit)
	{
		this.unit = unit;
	}

	public int getNumber()
	{
		return number;
	}

	public void setNumber(int number)
	{
		this.number = number;
	}

	public String getFlavor()
	{
		return flavor;
	}

	public void setFlavor(String flavor)
	{
		this.flavor = flavor;
	}

	public int getOutput_status()
	{
		return output_status;
	}

	public void setOutput_status(int output_status)
	{
		this.output_status = output_status;
	}

	public String getD_id_key()
	{
		return d_id_key;
	}

	public void setD_id_key(String d_id_key)
	{
		this.d_id_key = d_id_key;
	}

	public String getD_id_value()
	{
		return d_id_value;
	}

	public void setD_id_value(String d_id_value)
	{
		this.d_id_value = d_id_value;
	}

	public String getStandard()
	{
		return standard;
	}

	public void setStandard(String standard)
	{
		this.standard = standard;
	}

	public String getStandard_types()
	{
		return standard_types;
	}

	public void setStandard_types(String standard_types)
	{
		this.standard_types = standard_types;
	}

	public String getOperateTypeId()
	{
		return operateTypeId;
	}

	public void setOperateTypeId(String operateTypeId)
	{
		this.operateTypeId = operateTypeId;
	}

	public FoodDetailInfo(JSONObject object)
	{
		this.name = object.optString("cn_name");
		this.food_id = object.optString("id");
		this.quantity = object.optInt("quantity");
		this.number = object.has("default_quantity") ? object.optInt("default_quantity") : object.optInt("quantity");
		this.weight = object.optInt("weight");
		this.price = object.optInt("price");
		this.unit = object.optString("unit");
		JSONArray taste_types = object.optJSONArray("taste_types");
		this.taste_types = (taste_types != null && taste_types.length() > 0 ? taste_types.toString() : "");
		JSONArray standard_types = object.optJSONArray("standard_type");
		this.standard_types = (standard_types != null && standard_types.length() > 0 ? standard_types.toString() : "");
		//详情里面默认设置配置的规格
		this.standard = (standard_types != null && standard_types.length() > 0 && ShoppingCartManager.isSelectStandard(standard_types.toString())
				? ShoppingCartManager.getStandardDetail(standard_types.toString()) : "");
	}

	public FoodDetailInfo(JSONObject object, String str)
	{
		this.name = object.optString("name");
		this.number = object.optInt("number");
		this.unit = object.optString("unit");
	}

	public FoodDetailInfo(String name)
	{
		this.name = name;
	}

	public FoodDetailInfo()
	{

	}

}
